package com.supreme.studyserver.configscan;

import com.external.study.anno.SyncFile;
import com.external.study.config.PathService;
import com.external.study.service.ReadFileService;
import com.external.study.service.SyncFileService;
import com.external.study.service.WriteFileService;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;

@Configuration
@ComponentScan(
        // 注入指定包的带有Component的类
        value = {"com.external.study.config"},
        // 注入带有Component注解的类
        basePackageClasses = {ReadFileService.class, SyncFileService.class},
        // 包含过滤策略
        includeFilters = {
                // 包含带有指定注解的类
                @ComponentScan.Filter(type = FilterType.ANNOTATION, classes = {SyncFile.class}),
                // 包含指定的类
                @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {WriteFileService.class})
        },
        // 排除过滤策略
        excludeFilters = {
                // 排除带有指定注解的类
//                @ComponentScan.Filter(type = FilterType.ANNOTATION, classes = {SyncFile.class}),
                // 排除指定的类
                @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {PathService.class})
        }
)
public class SupremeScanner {

}
